<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
        <script type="text/javascript" src="js/libs/autocomplete.js"></script>
        <script type="text/javascript" src="js/libs/jquery-1.3.2.min.js"></script>
        <link rel="stylesheet" type="text/css" href="css/default.css">
        <link rel="stylesheet" type="text/css" href="css/exitPark.css">
        <link rel="stylesheet" type="text/css" href="css/menu.css">
        <link rel="stylesheet" type="text/css" href="css/autocomplete.css">


        <script type="text/javascript">
            $(document).ready(function(){
                new Autocomplete("parkCli", function() {
                    this.setValue = function(cpf,idcli) {
                        $("#parkCpfResInput").val(cpf);
                        $("#parkCliId").val(idcli); 
                    }
                    if ( this.isModified ){
                        this.setValue("");
                    }
                    if ( this.value.length < 1 && this.isNotClick ){
                        return ;
                    }
                    return "autoCompleteCli.php?q=" + this.value;
                });

            });
        </script>

        <script type="text/javascript">
            $(document).ready(function(){
                new Autocomplete("parkPlaque", function() {
                    this.setValue = function(model,color,year,idcar,mark) {
                        $("#parkMarkInput").val(mark);
                        $("#parkModelInput").val(model);
                        $("#parkColorInput").val(color);
                        $("#parkYearInput").val(year);
                        $("#parkCarId").val(idcar);
                        
                    }
                    if ( this.isModified ){
                        this.setValue("");
                    }
                    if ( this.value.length < 1 && this.isNotClick ){
                        return ;
                    }
                    return "autoCompleteCar.php?q=" + this.value;
                });

            });
        </script>
    </head>
    <body>
        <div id="container">

            <div id="title">
                <div id="img">
                <img src="css/ico_car.png"/>
                </div>
                <div id="h1">
                <h1>Park Control</h1>
                </div>
            </div>
            <div id="menu">
                <ul class="menu">
                    <li><a href="#" title="Cadastros">Cadastros</a>
                        <ul>
                            <li><a href="newCli.php" target="_parent" >Cadastrar Clientes</a></li>
                            <li><a href="newCar.php" target="_parent">Cadastrar Carros</a></li>
                            <li><a href="newFares.php" target="_parent">Cadastrar Tarifas</a></li>
                        </ul>
                    </li>
                    <li><a href="#" title="Gerenciar">Gerenciar</a>
                        <ul>
                            <li><a href="newPark.php" target="_parent">Entrada de Carros</a></li>
                            <li><a href="relExitPark.php" target="_parent">Saida de Carros</a></li>
                        </ul>
                    </li>
                    <li><a href="#" title="Relatorios">Relatorios</a>
                        <ul>
                            <li><a href="relCar.php" target="_parent">Relatório de Carros</a></li>
                            <li><a href="relCli.php" target="_parent">Relatório de Clients</a></li>
                            <li><a href="relPark.php" target="_parent">Relatório de Entradas</a></li>    
                        </ul>
                    </li>
                </ul>
            </div>

            <form method="POST" action="action/InsertExit.action.php" name="exitPark" id="exitPark">
                <?php include "action/EditExit.action.php"; ?>
                <div id="exitpark">
                    <div id="span"> 
                        <span id="exitParkError" class="error"><h2>Saida de Carros</h2></span>
                    </div>

                    <fieldset>
                        <input type="hidden" id="parkCliId" name="idcli" value="<?php echo $park->getidClients(); ?>"/>
                        <input type="hidden" id="idcar" name="idcar" value="<?php echo $park->getidCar(); ?>"/>
                        <input type="hidden" id="parkId" name="id" value="<?php echo $park->getId(); ?>"/>

                        <label id="exitParkCliLabel">
                            Cliente:
                            <input type="text" id="parkCliInput" name="parkCli" value="<?php echo $park->getClients(); ?>" size=15 maxlength=15>
                        </label> 

                        <label id="exitParkCpfLabel" class="onlyread">
                            CPF:
                            <input type="text" id="parkCpfResInput" name="cpf" value="<?php echo $park->getCpf(); ?>" readonly="true" size=11 maxlength=11 >
                        </label>

                        <label id="exitPlaque">
                            Placa:
                            <input type="text" id="parkCarInput" name="parkPlaque" value="<?php echo $park->getPlaque(); ?>" size=8 maxlength=8>
                        </label>

                        <label id="exitParkModelLabel" class="onlyread">
                            Modelo:
                            <input type="text" id="parkModelInput" name="model" value="<?php echo $park->getModel(); ?>" readonly="true" >
                        </label>

                        <label id="exitParkModelLabel" class="onlyread">
                            Marca:
                            <input type="text" id="parkMarkInput" name="mark" value="<?php echo $park->getMark(); ?>" readonly="true" >
                        </label>

                        <label id="exitParkYearLabel" class="onlyread">
                            Ano:
                            <input type="text" id="parkYearInput" name="year" value="<?php echo $park->getYear(); ?>" readonly="true" size=3 maxlength=3>
                        </label>

                        <label id="exitParkDateIn">
                            Data\Hora Entrada:
                            <input type="text" id="newParkDateIn" name="dateIn" value="<?php echo $park->getDatein(); ?>" readonly="true" size=14 maxlength=14>
                        </label>

                        <label id="exitDateoutInput">
                            Data\Hora Saída:
                            <input type="text" id="parkDateoutInput" name="dateout" readonly="true" size=14 maxlength=14 value="<?php ini_set('date.timezone', 'America/SAO_PAULO');
                echo date("d/m/y H:i:s"); ?>" >
                        </label>

                        <label id="parkHoraInput">
                            Qtd. de horas:
                            <input type="text" id="parkHoraInput" name="parkHoraInput" readonly="true" value="<?php echo $park->getHours(); ?>" size=2 maxlength=2>
                        </label>

                        <label id="parkTaxInput">
                            Tarifa (R$):
                            <input type="text" id="tarifa" name="tarifa" readonly="true" value="  <?php echo number_format($park->getFare(), 2, '.', '.'); ?>" >
                        </label>

                        <label id="parkValorInput">
                            Valor (R$):
                            <input type="text" id="parkValorInput" name="parkValorInput" readonly="true" value="<?php echo number_format($park->getTotal(), 2, '.', '.'); ?>" >
                        </label>
                    </fieldset>
                </div>
                <div id="buttons">        
                    <input type="button" id="exitOkButton" value = "Enviar" />
                    <input type="reset" id="exitResetButton" value = "Limpar" />
                </div>

            </form>
        </div>   
        <script type="text/javascript" src="js/exitPark.js"></script>
        <script type="text/javascript" src="js/validation.js"></script>
    </body>
</html>